<?php

require_once "./vendor/autoload.php";

use phpspider\core\phpspider;

/* Do NOT delete this comment */
/* 不要删除这段注释 */

$configs = array(
    'name' => '简书',
    'domains' => array(
        'jianshu.com',
        'www.jianshu.com'
    ),
    'scan_urls' => array(
        'https://www.jianshu.com/c/V2CqjW?utm_medium=index-collections&utm_source=desktop'
    ),
    'content_url_regexes' => array(
        "https://www.jianshu.com/p/\d+"
    ),
    'list_url_regexes' => array(
        "https://www.jianshu.com/c/\d+"
    ),
    'export' => array(
        'type' => 'csv', 
        'file' => './data/jianshu.csv', // data目录下，会自动新建data目录
    ),
    'max_try' => 5,
    'fields' => array(
        array(
            'name' => "title",
            'selector' => "//h1[@class='_1RuRku']",
            'required' => true,
        ),
        array(
            'name' => "content",
            'selector' => "//article[@class='_2rhmJa']",
            'required' => true,
        ),
    ),
);

$spider = new phpspider($configs);
$spider->start();
